<!--
 * @Descripttion: 
 * @Version: 1.0
 * @Author: wangph
 * @Date: 2021-03-31 09:46:02
 * @LastEditors: wangph
 * @LastEditTime: 2021-04-27 10:13:30
-->
<!DOCTYPE HTML>
<html>
<head>
    <title>{:config('web_site_title')} - {:lang('管理员登录')}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="__PLUG__/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="__PLUG__/font-awesome/css/font-awesome.min.css">
	<link rel="stylesheet" href="__PLUG__/jqueryToast/css/toast.css">
	<link rel="stylesheet" href="__ADMIN_CSS__/AdminLTE.min.css">
	<link rel="stylesheet" href="__ADMIN_CSS__/style.css">
</head>
<body class="theme-white">
<div class="main-content">
    <div class="signin-bg">
        <h2 class="title1 gradient text-center">{:config('web_site_title')}</h2>
            <div class="login-body">
                <form action="{:url()}" method="post" id="login" data-validator-option="{timely:0, theme:'bootstrap'}">
					<div class="form-group">
						<div class="col-lg-12 pd0 mb15">
							<input type="text" class="form-control" name="username" placeholder="{:lang('请输入用户名')}" data-rule="required;username;" data-rule-username="[/^[\w\d]{3,12}$/, '请输入正确的用户名']" data-msg-required="{:lang('用户名不能为空')}">
						</div>
						<div class="col-lg-12 pd0 mb15">
							<input type="password" name="password" class="form-control" placeholder="{:lang('请输入密码')}" data-rule="required;length(5~16)" data-msg-required="{:lang('密码不能为空')}" data-msg-length="请填写6-16位密码">
						</div>
					</div>
                    {notempty name="Think.config.captcha_signin"}
                    <div class="form-group">
                        <div class="col-xs-7" style="padding:0">
                            <input class="lock" type="text" name="captcha" placeholder="{:lang('请输入验证码')}" data-rule="required;" data-msg-required="{:lang('验证码不能为空')}">
                        </div>
                        <div class="col-xs-5" style="padding:0">
                            <img src="{:captcha_src('admin')}" class="pull-right" id="captcha" style="cursor: pointer;height:40px"
                                  title="{:lang('点击刷新')}" alt="captcha"/>
                        </div>
                    </div>
                    {/notempty}
                    <div class="clearfix"></div>
                    <div class="forgot-grid pb10">
                        <div class="forgot pull-left">
                            <a href="#">{:lang('忘记密码')}?</a>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <input type="submit" class="btn btn-block btn-success btn-sm" name="登 录" value="登 录">
                </form>
            </div>
    </div>
</div>
<script src="__PLUG__/jquery/jquery.min.js"></script>
<script src="__PLUG__/jqueryToast/js/toast.js"></script>
<script src="__PLUG__/nice-validator/jquery.validator.min.js?local=zh-CN"></script>
<script src="__ADMIN_JS__/stars.js"></script>
<script>
    $(document).ready(function () {
        $('#login').on('valid.form', function (e) {
            var $data = $(this).serialize();

            Stars.loading();
            $.post($(this).attr('action'), $data, function (res) {
                Stars.loading('hide');
                if (res.code) {
                    Stars.notify('登录成功，页面即将跳转~', 'success');
                    setTimeout(function () {
                        location.href = res.url;
                    }, 1500);
                } else {
                    if (res.msg == '验证码错误或失效') {
                        $('#captcha').click();
                    }
                    Stars.notify(res.msg, 'danger','fa fa-bell-slash');
                }
            }).fail(function () {
                Stars.loading('hide');
                Stars.notify('服务器错误~', 'danger');
            });
            return false;
        });
    });
</script>
</body>
</html>